package com.whosly.mysql.protocol;

/**
 * @author fengyang
 * @date 2023/8/17 下午10:10
 * @see <a href="yueny09@163.com">mailTo: yueny09@163.com</a>
 */
public enum MysqlErrorCode
{

    ER_DB_CREATE_EXISTS(1007, "HY000"),
    ER_DB_DROP_EXISTS(1008, "HY000"),
    ER_TABLE_EXISTS_ERROR(1050, "42S01"),
    ER_NO_SUCH_TABLE(1146, "42S02"),
    ER_DUP_FIELDNAME(1060, "42S21"),
    ER_BAD_FIELD_ERROR(1054, "42S22"),
    ER_USER_DOES_NOT_EXIST(3162, "HY000"),
    ER_USER_ALREADY_EXISTS(3163, "HY000"),
    ER_ACCESS_DENIED_ERROR(1045, "28000"),
    ER_PASSWORD_NO_MATCH(1133, "42000"),
    ER_ABORTING_CONNECTION(1151, "08S01"),
    ER_PARSE_ERROR(1064, "42000"),
    ER_UNRESOLVED_HINT_NAME(3128, "HY000"),
    ER_WRONG_ARGUMENTS(1210, "HY000"),
    ER_UNSUPPORTED_ENGINE(1726, "HY000"),
    ER_INCORRECT_TYPE(3064, "HY000"),
    ER_QUERY_INTERRUPTED(1317, "70100"),
    ER_INTERNAL_ERROR(1815, "HY000"),
    ER_DISK_FULL(1021, "HY000"),
    ER_CANT_FIND_SYSTEM_REC(1012, "HY000"),
    ER_INVALID_DEFAULT(1067, "42000"),
    ER_DBACCESS_DENIED_ERROR(1044, "42000"),

    //DTS单独分配的9001错误码
    ER_NOTIFY_DTS_INTERRUPT(9001, "DTS00");


    private final int errorNo;
    private final String sqlState;

    private MysqlErrorCode(int errorNo, String sqlState) {
        this.errorNo = errorNo;
        this.sqlState = sqlState;
    }

    public int getErrorNo() {
        return errorNo;
    }

    public String getSqlState() {
        return sqlState;
    }
}
